/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Serif SC', serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 400;
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 卡片通用样式 */
.instruction-card,
.time-card,
.process-card,
.result-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
}

/* 说明区域 */
.instruction-card h2 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.steps {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.step {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.step-number {
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.step p {
    margin: 0;
    color: #4a5568;
}

/* 占卜事项输入区域样式 */
.question-section {
    margin-bottom: 20px;
}

.question-card {
    background: linear-gradient(135deg, #fff8e1 0%, #fff3c4 100%);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #f0c674;
}

.question-card h3 {
    color: #8b4513;
    margin-bottom: 15px;
    font-size: 1.1rem;
    text-align: center;
}

.question-input-group {
    position: relative;
}

.question-textarea {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.question-textarea:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
    background: white;
}

.question-textarea::placeholder {
    color: #999;
    font-size: 14px;
}

.char-count {
    text-align: right;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.char-count.warning {
    color: #ff9800;
}

.char-count.danger {
    color: #f44336;
}

/* 时间选择区域 */
.time-card h3 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.time-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 500;
    color: #4a5568;
    font-size: 0.95rem;
}

.time-select {
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    color: #4a5568;
    transition: all 0.3s ease;
    font-family: inherit;
}

.time-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 占卜按钮 */
.divination-btn,
.restart-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.divination-btn:hover,
.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.divination-btn:active,
.restart-btn:active {
    transform: translateY(0);
}

/* 占卜过程动画 */
.process-card h3 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    margin-bottom: 25px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s ease;
}

.liuren-circle {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 0 auto 25px;
    border: 3px solid #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.palace {
    position: absolute;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.palace:nth-child(1) { top: -30px; left: 50%; transform: translateX(-50%); }
.palace:nth-child(2) { top: 20px; right: -30px; }
.palace:nth-child(3) { bottom: 20px; right: -30px; }
.palace:nth-child(4) { bottom: -30px; left: 50%; transform: translateX(-50%); }
.palace:nth-child(5) { bottom: 20px; left: -30px; }
.palace:nth-child(6) { top: 20px; left: -30px; }

.palace.active {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    transform: scale(1.2);
    z-index: 10;
}

.center-dot {
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    position: absolute;
}

.calculation-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step-info {
    padding: 12px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 3px solid #667eea;
    transition: all 0.3s ease;
}

.step-info.active {
    background: linear-gradient(135deg, #e6fffa, #b2f5ea);
    border-left-color: #38b2ac;
    transform: translateX(5px);
}

.step-label {
    font-weight: 600;
    color: #667eea;
}

.step-desc {
    color: #4a5568;
}

/* 结果展示区域 */
.result-section {
    padding: 20px;
    animation: slideInUp 0.6s ease-out;
}

.result-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    color: white;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="stars" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23stars)"/></svg>');
    opacity: 0.3;
    pointer-events: none;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    position: relative;
    z-index: 1;
}

.result-header h3 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.result-time {
    font-size: 0.9rem;
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.result-palace {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.palace-name {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.4);
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5)); }
    to { filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8)); }
}

.palace-meaning {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 20px;
    font-style: italic;
}

.divination-question {
    background: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

.divination-question h5 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffd700;
}

.question-display {
    font-size: 1rem;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #ffd700;
}

.result-interpretation,
.result-advice {
    margin-bottom: 25px;
    position: relative;
    z-index: 1;
}

.result-interpretation h4,
.result-advice h4 {
    margin: 0 0 15px 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #ffd700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.interpretation-content,
.advice-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    line-height: 1.8;
    font-size: 1rem;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.fortune-details {
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.fortune-details h4 {
    margin: 0 0 20px 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #ffd700;
    text-align: center;
}

.fortune-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.fortune-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.fortune-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.2);
}

.fortune-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.fortune-label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #ffd700;
}

.fortune-text {
    font-size: 0.85rem;
    line-height: 1.5;
    opacity: 0.9;
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.restart-btn,
.share-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(238, 90, 36, 0.3);
    position: relative;
    overflow: hidden;
}

.share-btn {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    box-shadow: 0 5px 15px rgba(68, 160, 141, 0.3);
}

.restart-btn::before,
.share-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.restart-btn:hover::before,
.share-btn:hover::before {
    left: 100%;
}

.restart-btn:hover,
.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(238, 90, 36, 0.4);
}

.share-btn:hover {
    box-shadow: 0 8px 25px rgba(68, 160, 141, 0.4);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .result-card {
        padding: 20px;
        margin: 10px;
    }
    
    .result-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .palace-name {
        font-size: 2.5rem;
    }
    
    .fortune-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .restart-btn,
    .share-btn {
        width: 100%;
        max-width: 250px;
    }
}

/* 结果卡片特殊样式 */
.result-card {
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: slideIn 2s ease-out;
}

/* 宫位特色背景 */
.result-palace.daan {
    background: linear-gradient(135deg, #48bb78, #38a169);
}

.result-palace.liulian {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
}

.result-palace.suxi {
    background: linear-gradient(135deg, #f56565, #e53e3e);
}

.result-palace.chikou {
    background: linear-gradient(135deg, #9f7aea, #805ad5);
}

.result-palace.xiaoji {
    background: linear-gradient(135deg, #4299e1, #3182ce);
}

.result-palace.kongwang {
    background: linear-gradient(135deg, #718096, #4a5568);
}

/* 底部 */
.footer {
    text-align: center;
    margin-top: 30px;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

/* 动画效果 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.palace.calculating {
    animation: pulse 1s infinite;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

@keyframes slideIn {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(102, 126, 234, 0.5); }
    50% { box-shadow: 0 0 20px rgba(102, 126, 234, 0.8), 0 0 30px rgba(102, 126, 234, 0.6); }
}

.instruction-section,
.time-section,
.divination-process,
.result-section {
    animation: fadeIn 0.6s ease-out;
}

.palace.active {
    animation: glow 2s infinite, bounce 1s ease-out;
}

.divination-btn:hover,
.restart-btn:hover {
    animation: bounce 0.6s ease-out;
}

.liuren-circle {
    animation: rotate 20s linear infinite;
}

.liuren-circle:hover {
    animation-play-state: paused;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .instruction-card,
    .time-card,
    .process-card,
    .result-card {
        padding: 20px;
    }
    
    .liuren-circle {
        width: 200px;
        height: 200px;
    }
    
    .palace {
        width: 50px;
        height: 50px;
        font-size: 0.8rem;
    }
    
    .palace:nth-child(1) { top: -25px; }
    .palace:nth-child(2) { top: 15px; right: -25px; }
    .palace:nth-child(3) { bottom: 15px; right: -25px; }
    .palace:nth-child(4) { bottom: -25px; }
    .palace:nth-child(5) { bottom: 15px; left: -25px; }
    .palace:nth-child(6) { top: 15px; left: -25px; }
}

@media (min-width: 768px) {
    .container {
        max-width: 600px;
        padding: 30px;
    }
    
    .time-inputs {
        flex-direction: row;
        gap: 20px;
    }
    
    .input-group {
        flex: 1;
    }
}